package com.bolt.report.engine.pool;

import com.bolt.report.definition.JdbcDataSourceDefinition;

import java.sql.Connection;
import java.sql.SQLException;

public interface JdbcConnectionPool {

    /**
     * 删除数据库连接池
     */
    void removeJdbcConnectionPool(String key);


    /**
     * 获取连接
     *
     * @param definition
     * @return
     * @throws SQLException
     */
    Connection getPooledConnection(JdbcDataSourceDefinition definition) throws SQLException;

    /**
     * 测试数据库连接  获取一个连接
     *
     * @param definition
     * @return
     * @throws ClassNotFoundException driverName不正确
     * @throws SQLException
     */
    void testConnection(JdbcDataSourceDefinition definition) throws SQLException;
}